package com.ruoyi.common.rabbitmq.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * MrPing
 */
@Configuration
public class MessageRabbitmqConfig {

    @Bean
    public DirectExchange messageExchange(){
        return new DirectExchange("yuanju.message.direct.exchange", true, true);
    }

    @Bean
    public Queue messageQueue(){
        return new Queue("yuanju.message.queue",true);
    }

    @Bean
    public Binding messageBinding(){
        return BindingBuilder.bind(messageQueue()).to(messageExchange()).with("message");
    }
}
